package com.geekca.d5.d6test;

public class BuyTickey {
    public static void main(String[] args) {
        double originalPrice = 3000;
        int month = 5;
        String seatClass = "EconomyClass";
        System.out.println(ticketDiscounts(originalPrice, month, seatClass));
    }

    public static double ticketDiscounts(double originalPrice, int month, String seatClass) {
        double discountPrice = 0;
        if (seatClass == "FirstClass") {
            switch (month) {
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                    discountPrice = originalPrice * 0.9;
                    break;
                case 11:
                case 12:
                case 1:
                case 2:
                case 3:
                case 4:
                    discountPrice = originalPrice * 0.7;
                    break;
                default:
                    System.out.println("月份输入错误");
                    break;
            }
        } else if (seatClass == "EconomyClass") {

            switch (month) {
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                    discountPrice = originalPrice * 0.85;
                    break;
                case 11:
                case 12:
                case 1:
                case 2:
                case 3:
                case 4:
                    discountPrice = originalPrice * 0.65;
                    break;
                default:
                    System.out.println("月份输入错误");
                    break;
            }
        } else {
            System.out.println("输入舱位有误");
        }

        return discountPrice;
    }
}
